@extends('layout.layout')
@section('title','首页')
@section('content')
    <div class="main">
        <div class="index_top clearfix">
            <div class="index_left">
                <div class="index_left_bg"><img src="/res/images/last_time_bg.jpg" /></div>
                <div class="index_left_body">


                    <div class="last_time">
                        <span class="time1">--</span>
                        <span class="time2">--</span>
                        <span class="time3">--</span>
                        <span class="time4">--</span>
                    </div>
                    <div class="before">
                        <div id="countdown-timer"></div>
                        <a class="class_href" href="#"></a>
                    </div>
                    <!--会议结束-->
                    <div class="end_title" style="display:none">会议已结束</div>
                    <!--会议进行中-->
                    <div class="meeting" style="display:none">
                        <a href="#">
                            <img src="/res/images/online_classing.png" />
                        </a>
                    </div>
                    <div class="left_share">
                        <span>分享到：</span>
                        <a href="#" onclick="err()"><img src="/res/images/icon_weixin.jpg" /></a>
                    </div>
                </div>
            </div>
            <div class="index_right">
                <div class="title_box">专家介绍</div>
                <div class="index_right_list">
                    @foreach($oexperts as $v)
                        <div class="index_right_ship clearfix">
                            <div class="index_right_img">
                                <a href="expert/info/{{$v->id}}"><img src={{$v->thumb}} /></a>
                            </div>
                            <div class="index_right_txt">
                                <p>专家：{{$v->name}}</p>
                                <p>职位: {{$v->job}}</p>
                                <p>医院: {{$v->hospital}}</p>
                                <p><a href="{{ url('/expert/info/' . $v->id) }}">&lt;&lt;详细&gt;&gt;</a></p>
                            </div>
                        </div>
                    @endforeach
                    <div class="index_right_more"><a href="/expert">更多</a></div>
                </div>
            </div>
        </div>
        <div class="review">
            <div class="title_box">精彩回顾</div>
            <div class="review_list">
                <div class="one_line clearfix">
                    @foreach($ovideos as $v)
                        @foreach($v->experts as $s)
                            <div class="review_ship">
                                <div class="review_ship_img">
                                    <a href="/review/info/{{$v->id}}">
                                        <img style="width: 265px;height: 155px" src={{$v->thumb}} />
                                    </a>
                                </div>
                                <div class="review_ship_txt">
                                    <div class="review_ship_title break"><a href="#">{{$v->title}}</a></div>
                                    <div class="review_ship_intro clearfix">
                                        <div class="review_ship_left">
                                            <p>主持：<a href="#">{{$s->name}}</a></p>
                                            <p>日期：<span class="txt_999">{{$v->begin}}</span></p>
                                        </div>
                                        <div class="review_ship_right">
                                            <a class="info_btn" href="/review/info/{{$v->id}}">查看详情</a>
                                        </div>
                                    </div>
                                </div>
                            </div> @endforeach
                    @endforeach
                </div>
            </div>
        </div>
    </div>
<!--微信分享弹窗-->
<div class="shadow" style="display:none"></div>
<div class="chat_pop" style="display:none">
    <div class="chat_pop_top"><a href="#" onclick="Pop_close1()" class="chat_pop_close"></a></div>
    <div class="chat_pop_body">
       <img src="/res/images/11.png">
        <p>使用微信扫一扫，并将网页分享给好友</p>
    </div>
</div>
@endsection
<script>
    function err(){
        let one=$('.shadow');
        let two=$('.chat_pop');
one.css('display','');
two.css('display','');
    }
    function Pop_close1(){
       // alert(1);
        let one1=$('.shadow');
        let two1=$('.chat_pop');
        one1.css('display','none');
        two1.css('display','none');
    }


</script>
<script>
    // 确定倒计时截止时间为最近一次开播时间
    var endTime = new Date('{{ $latestStartTime }}');

    // 更新倒计时显示数据
    function updateCountdown() {
        var now = new Date();
        var timeLeft = endTime - now;

        // 计算剩余的天、小时、分钟和秒数
        var days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
        var hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        var minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
        var seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);

        // 获取页面元素
        var time1 = document.querySelector('.time1');
        var time2 = document.querySelector('.time2');
        var time3 = document.querySelector('.time3');
        var time4 = document.querySelector('.time4');

        // 更新页面元素内容
        time1.innerHTML = days;
        time2.innerHTML = hours < 10 ? '0' + hours : hours;
        time3.innerHTML = minutes < 10 ? '0' + minutes : minutes;
        time4.innerHTML = seconds < 10 ? '0' + seconds : seconds;
    }

    // 每秒钟更新一次倒计时数据
    setInterval(updateCountdown, 1000);
</script>
